<template>
  <div>
    <br/>

    <el-form ref="form" :model="form" label-width="80px" :inline="true" :label-position="labelPosition" size="small">
      <el-form-item label="姓名">
        <el-input v-model="form.name"></el-input>
      </el-form-item>
      <el-form-item label="所属部门">
        <el-select v-model="form.region" placeholder="请选择所在部门">
          <el-option label="苹果手机组装一部" value="1"></el-option>
          <el-option label="苹果手机组装二部" value="2"></el-option>
          <el-option label="华为手机组装部" value="3"></el-option>
          <el-option label="Vivo手机组装部" value="4"></el-option>
          <el-option label="小米手机组装部" value="5"></el-option>
          <el-option label="OPPO手机组装部" value="6"></el-option>
        </el-select>
      </el-form-item>
      <br>
      <el-form-item label="手机号码">
        <el-input v-model="form.phone"></el-input>
      </el-form-item>
      <el-form-item label="是否有效">
        <el-switch v-model="form.delivery"></el-switch>
      </el-form-item>
      <br>
      <el-form-item label="个人爱好">
        <el-checkbox-group v-model="form.type">
          <el-checkbox label="读书" value="1"></el-checkbox>
          <el-checkbox label="爬山" value="2"></el-checkbox>
          <el-checkbox label="跑步" value="3"></el-checkbox>
          <el-checkbox label="篮球" value="4"></el-checkbox>
        </el-checkbox-group>
      </el-form-item>
      <br>
      <el-form-item label="性别">
        <el-radio-group v-model="form.resource">
          <el-radio label="男"></el-radio>
          <el-radio label="女"></el-radio>
        </el-radio-group>
      </el-form-item>
      <br>
      <el-form-item label="自我介绍">
        <el-input type="textarea" v-model="form.desc" :autosize="{ minRows: 2, maxRows: 4}"></el-input>
      </el-form-item>
      <br>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">修改</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
  import ElCol from "element-ui/packages/col/src/col";
  import * as cmsApi from '../api/cms'
  export default {
    components: {ElCol},
    data() {
      return {
        form: {
          name: '霍去病',
          phone: '13386551555',
          region: '3',
          date1: '',
          date2: '',
          delivery: true,
          type: ['读书', '篮球'],
          resource: '男',
          desc: ''
        },
        labelPosition: 'right',
      }
    },
    methods: {
      onSubmit() {
        console.log('submit!');
      },
      query: function (val) {
        //调用服务端接口
        cmsApi.page_list(1, 2).then((res) => {
//          this.total = res.queryResult.total;
//          this.list = res.queryResult.list;
        });
        //调用服务端接口
        let params = {
          name: '高浩东',
          age: 23,
          phone: '2223423'
        }
        cmsApi.people_list(params).then((res) => {
          console.log(res)
//          this.total = res.queryResult.total;
//          this.list = res.queryResult.list;
        });
      },

    },
    mounted() {
      //钩子函数
      this.query()
    }
  }
</script>
<style>


</style>
